<?php

/* @var $_this View */
/* @var $form FormHelper */
/* @var $editForm EditFormHelper */
/* @var $html HtmlHelper */
/* @var $ehtml EHtmlHelper */
/* @var $javascript JavascriptHelper */
/* @var $jqax JqaxHelper */
/* @var $filterBlock FilterBlock */

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><?php
?><html xmlns="http://www.w3.org/1999/xhtml"><?php
?><head><?php
?><?=$html->charset(DEFAULT_CHARSET);?><?php
?><title><?=h($title_for_layout);?></title><?php

?><?php
if (Configure::read('debug')) {
    Page::addCSS('cake');
}
Page::addCSS('style');
foreach (Page::$css as $i => $file) {
    $attribs = array();
    if (isset(Page::$css_media[$i])) {
        $attribs['media'] = Page::$css_media[$i];
    }
    echo $html->css($file, null, $attribs);
}
Page::addJS('jquery-1.2.2.pack');
Page::addJS('main');
Page::addJS('cookies');
foreach (Page::$js as $file) {
    ?><script type="text/javascript" src="<?=Application::rootUrlPath();?>/js/<?=$file;?>.js"></script><?php
}
?><script type="text/javascript">var __sys_img_url_root="<?=Application::imgUrlPath();?>";</script><?php
?><?=$scripts_for_layout;?><?php
?></head><?php

?><body onload="sys_onLoad();resizeContent();$(window).resize(resizeContent);"><?php

    foreach (Page::$jsStrat as $code) {
        ?><?=$javascript->codeBlock($code);?><?php
    }

        ?><div id="sys_cs_wrap-layout" class="sys_cs_wrap sys_cs_fh sys_layout"><?php
        ?><table id="layout" class="sys_cs_box sys_cs_fh sys_cs_fhp_table sys_layout" cellpadding="0"><?php
        ?><tr class="sys_clear"><?php
        ?><td id="content-cell" class="sys_clear"><?php
        ?><div id="header-cell"><?php
            ob_start();
                ?><?php $session->check("Message.flash") ? $session->flash() : ""; ?><?php
            $_draw_flash_message = ob_get_clean();

            $_draw_top_items = $this->renderElement('top_items', array(), true);
            //$_draw_login_block = $this->renderElement('login_block', array(), true);
            ?><table id="header-wrapper" style="width: 100%;" cellpadding="0" class="sys_layout"><?php
            ?><tr id="top-row" class="sys_clear"><?php
            ?><td class="sys_clear" style="width: 102px; height: 65px;"><?php
            /*?><div id="logo-container"><?php
                if ($GLOBALS['Dispatcher']->here == '/') {
                    ?><img src="<?=Application::rootUrlPath();?>/img/logo.gif" /><?php
                } else {
                    ?><a href="<?=Application::rootUrlPath();?>/"><img src="<?=Application::rootUrlPath();?>/img/logo.gif" /></a><?php
                }

                ?><span><?php
                ?></span><?php
            ?></div><?php*/
           /* ?><br /><?php*/
            ?></td><?php
            ?><td id="main-caption" class="sys_clear"><?php
               /* ?><?=__d(null, 'logo_caption', true);?> <?php*/
            ?></td><?php
            ?><td id="top-container" class="sys_clear"><?php
                ?><?=$_draw_top_items;?><?php
               /* ?><div id="header-container" class="sys_layout4float"><?php
                    if (strlen($_draw_login_block)) {
                        ?><div id="login-block-container" class="sys_layout"><?php
                            ?><?=$_draw_login_block;?><?php
                        ?></div><?php
                    }
                ?></div><?php*/
                ?><div class="sys_layout align-r"><?php
            if (Auth::o()->is('client_admin') && Auth::o()->is('active')) {
                ?><div id="balance-wrapper"><?php
                ?><span id="balance"><?php
                ?><?=$this->renderElement('sum', array('sum' => $client_data['Client']['balance']), true);?><?php
                $frozen_balance = ! empty($client_data['Client']['frozen_balance']) ? $client_data['Client']['frozen_balance'] : null;
                if (bc::eq($frozen_balance, 0)) {
                    $frozen_balance = null;
                }
                if (isset($frozen_balance)) {
                    ?> (<?=$this->renderElement('sum', array('sum' => $frozen_balance), true);?>)<?php
                }
                ?> <?=$this->renderElement('currency', array('currency' => 'EP'), true);?><?php
                ?></span><?php
                ?></div><?php
            }
            ?><?=$this->renderElement('top_menu');?><?php
			?></div><?php

            ?></td><?php
            ?></tr><?php

            ?><tr class="sys_clear"><?php
            ?><td colspan="3" class="sys_clear" style="vertical-align: bottom;"><?php
                ?><div id="flash-message-container"><?php
                if (strlen($_draw_flash_message)) {
                        ?><?=$_draw_flash_message;?><?php
                } else {
                    ?><span class="sys_empty4ie"></span><?php
                }
                ?></div><?php
            ?></td><?php
            ?></tr><?php

    ?><tr class="sys_clear"><?php
    ?><td colspan="3" class="sys_clear"><?php
        ?><div id="menu-wrapper"><?php
            ?><?=$this->renderElement('main_menu');?><?php
    ?></div><?php
    ?></td><?php
    ?></tr><?php

            ?></table><?php


            $_draw_breadcrumbs = '';//$this->renderElement('breadcrumbs');
        ?></div><?php
        ?><table id="content-frame" class="sys_layout sys_clear" cellpadding="0"><?php
        ?><tr class="sys_clear"><?php
        ?><td id="content-frame-top" class="sys_clear"><?php

            /* C O N T E N T (begin) */
            ob_start();

                /* L E F T  M E N U (begin) */
                ob_start();

                    /*$_draw_left_menu_header = '';//$this->renderElement("left_menu_header");

                    $_draw_left_menu = '';//$this->renderElement("left_menu");

                    $_draw_client_account = $this->renderElement("client_admin_account");

                    if (strlen($_draw_left_menu_header) || strlen($_draw_left_menu) || strlen($_draw_client_account)) {
                        ?><div id="leftbar-container" class="sys_layout"><?php
                            if (strlen($_draw_left_menu_header)) {
                                ?><div id="leftbar-header" class="sys_layout"><?php
                                    ?><?=$_draw_left_menu_header;?><?php
                                ?></div><?php
                            }
                            ?><div id="leftbar-body" class="sys_layout"><?php
                                if (strlen($_draw_left_menu) || strlen($_draw_client_account)) {
                                    ?><?=$_draw_left_menu;?><?php
                                    ?><?=$_draw_client_account;?><?php
                                } else {
                                    ?><span class="sys_empty4ie"></span><?php
                                }
                            ?></div><?php
                        ?></div><?php
                    }*/

                $_out_left_menu = ob_get_clean();
                /* L E F T  M E N U (end) */




                /* C O N T E N T  C O N T A I N E R (begin) */
                ob_start();

                    $_draw_content_body = $this->renderElement("content", array('content_for_layout' => $content_for_layout));

                    if (strlen($_draw_content_body)) {
                        ?><div id="content-container" class="sys_layout"><?php
                            if (strlen($_draw_content_body)) {
                                ?><div id="content-body" class="sys_layout"><?php
                                    ?><?=$_draw_content_body;?><?php
                                ?></div><?php
                            }
                        ?></div><?php
                    }

                $_out_content_container = ob_get_clean();
                /* C O N T E N T  C O N T A I N E R (end) */

                if (strlen($_out_left_menu) || strlen($_out_content_container)) {
                    ?><div id="main-body" class="sys_layout"><?php
                        ?><?=$_out_left_menu;?><?php
                        ?><?=$_out_content_container;?><?php
                    ?></div><?php
                }


            $_draw_content = ob_get_clean();
            /* C O N T E N T (end) */

            $_out_content = '';
            if (strlen($_draw_content)) {
                $_out_content = $_draw_content;
            }

            if (strlen($_draw_breadcrumbs) || strlen($_out_content)) {
                ?><div id="main-container" class="sys_layout"><?
                    if (strlen($_draw_breadcrumbs)) {
                        ?><div id="breadcrumbs-container" class="sys_layout"><?
                            ?><?=$_draw_breadcrumbs;?><?php
                        ?></div><?php
                    }
                    ?><?=$_out_content;?><?php
                ?></div><?php
            }


            ?></td><?php
            ?></tr><?php
            $widget =& Layout::o()->widget;
            $this->renderElement('left_menu');
            if (!empty($widget['bottom-part'])) {
                ?><tr><?php
                ?><td id="content-frame-bottom" class="sys_clear"><?php
                    ?><table id="content-frame-bottom-wrapper" class="sys_clear" cellpadding="0"><?php
                    ?><tr class="sys_clear" ><?php
                    ?><td id="content-frame-bottom-container" class="sys_clear" ><?php
                        ?><?=$widget['bottom-part'];?><?php
                    ?></td><?php
                    ?></tr><?php
                    ?></table><?php
                ?></td><?php
                ?></tr><?php
            }
            ?></table><?php
        ?></td><?php
        ?></tr><?php
        ?><tr class="sys_clear"><?php
        ?><td id="footer-container" class="sys_cs_fhp_footer sys_clear" style="height: 3em;"><?php

            ?><div id="footer-container-reducer"><?php

            /* F O O T E R (begin) */
                ?><div id="footer-caption"><?=h(sprintf(__d(null, 'copyright1', true), date('Y'), X_VERSION));?></div><?php
                ?><div id="footer-caption2"><?=h(__d(null, 'copyright2', true));?></div><?php
            ?></div><?php

            /* F O O T E R (end) */

        ?></td><?php
        ?></tr><?php
        ?></table><?php

    ?></div><?php
    foreach (Page::$jsEnd as $code) {
        ?><?=$javascript->codeBlock($code);?><?php
    }


?><script type="text/javascript" src="<?=Application::rootUrlPath();?>/js/style.js"></script><?php
?></body><?php
?></html><?php

$f = microtime(true);
if (Configure::read('debug')) {
    global $request_time, $pre_render_time, $filter_time, $prepare_time;
    $this_time = microtime(true);
    $render_time = $this_time - $pre_render_time;
    $total_time = $this_time - $request_time;
    $prepare_time_str = number_format(($prepare_time), 3, ',', ' ');
    header("X-Render-Time-Prepare: \" ".intval($prepare_time*100/$total_time)."% {$prepare_time_str} s\"");
    $filter_time_str = number_format(($filter_time), 3, ',', ' ');
    header("X-Render-Time-Filter: \" ".intval($filter_time*100/$total_time)."% {$filter_time_str} s\"");
    $render_time_str = number_format(($render_time), 3, ',', ' ');
    header("X-Render-Time-Render: \" ".intval($render_time*100/$total_time)."% {$render_time_str} s\"");
    $total_time_str = number_format(($total_time), 3, ',', ' ');
    header("X-Render-Time: \"100% {$total_time_str} s\"");
}

?>